import pygame, sys
from pygame.locals import *
import random

pygame.init()
screen = pygame.display.set_mode([640, 480])
screen.fill([255, 255, 255])
pygame.display.update()
clock = pygame.time.Clock()
z = 0
pygame.display.set_caption('PAINT WINDOW')

while 1:
    colour = [random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)]
    clock.tick(60)
    x, y = pygame.mouse.get_pos()
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.display.quit()
            exit()
        elif event.type == MOUSEBUTTONDOWN:
            z = 1
        elif event.type == MOUSEBUTTONUP:
            z = 0
        if z == 1:
            pygame.draw.circle(screen, colour, [x, y], 30, 0)
            pygame.display.update()
            
            
print 'disater'
